export default {
    bind(el, binding, vnode){
/*

        v-for
         binding.value = [
         "选项1",
         "选项2",
         "选项3",
         "选项4",
         ];
 // el ===> <div class="navItem" :key=index @click="changeNav(index)"></div>
 // let div = '<div  class="navItem" @click="changeNav(index)"></div>'
        for(let i=0;i<binding.value.length;i++){
            let item = binding.value[i];
            let elCopy = cloneElemeint(el);
            elCopy.innerHTML = item;
            elCopy.attribute("key", i);
            elCopy.addEventListener("click", changeNav);
            el.parent.addChild(elCopy)
        }*/

/*// v-if  = "a === 1"
        binding.value = true;
        binding.value = false;
        if(binding.value){
            el.style.display = "block";
        }else {
            el.style.display = "none";
        }*/
        const bindValue = binding.value;
        const divList = el.getElementsByClassName(bindValue.className);

        console.log("bindValue",bindValue);
        console.log("divList",divList);
        divList[bindValue.activeId].className += ` ${bindValue.activeClass}`;
    },
    update(el, binding, vnode){


        const bindValue = binding.value;
        const bindOldValue = binding.oldValue;
        const divList = el.getElementsByClassName(bindValue.className);

        console.log("update========>bindValue",bindValue);
        console.log("update========>bindValue",binding);


/*        for (let i=0;i<divList.length;i++){
            divList[i].className = bindValue.className
        }*/
        divList[bindOldValue.activeId].className = bindValue.className;
        divList[bindValue.activeId].className += ` ${bindValue.activeClass}`;




    },
}